package com.example.mapper;

import com.example.entity.DiagnosticRequest;
import com.example.entity.DiagnosticReport;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface DiagnosticMapper {

    // 保存诊断请求
    @Insert("INSERT INTO diagnostic_requests(request_id, user_id, face_img, tongue_img, main_corporeity) " +
            "VALUES(#{requestId}, #{userId}, #{faceImg}, #{tongueImg}, #{mainCorporeity})")
    void saveDiagnosticRequest(DiagnosticRequest request);

    // 保存诊断报告
    @Insert("INSERT INTO diagnostic_reports(report_id, request_id, main_corp, report_text) " +
            "VALUES(#{reportId}, #{requestId}, #{mainCorp}, #{reportText})")
    void saveDiagnosticReport(DiagnosticReport report);

    // 获取诊断请求
    @Select("SELECT * FROM diagnostic_requests WHERE request_id = #{requestId}")
    DiagnosticRequest getDiagnosticRequestById(String requestId);
}

